kconfig: qconf: remove mouse{Press,Move}Event() functions
PATCH 1/13 kconfig: qconf: remove mouse{Press,Move}Event() functions
These functions simply passes the event to the parent.
---
scripts/kconfig/qconf.cc | 14 -------------- scripts/kconfig/qconf.h | 2 -- 2 files changed, 16 deletions(-)
scripts/kconfig/qconf.cc +0 -14
@@ -781,13 +781,6 @@ void ConfigList::keyPressEvent(QKeyEvent* ev) ev->accept(); } -void ConfigList::mousePressEvent(QMouseEvent* e) -{ - //QPoint p(contentsToViewport(e->pos())); - //printf("contentsMousePressEvent: %d,%d\n", p.x(), p.y()); - Parent::mousePressEvent(e); -} - void ConfigList::mouseReleaseEvent(QMouseEvent* e) { QPoint p = e->pos();
@@ -834,13 +827,6 @@ skip: Parent::mouseReleaseEvent(e); } -void ConfigList::mouseMoveEvent(QMouseEvent* e) -{ - //QPoint p(contentsToViewport(e->pos())); - //printf("contentsMouseMoveEvent: %d,%d\n", p.x(), p.y()); - Parent::mouseMoveEvent(e); -} - void ConfigList::mouseDoubleClickEvent(QMouseEvent* e) { QPoint p = e->pos();
scripts/kconfig/qconf.h +0 -2
@@ -55,9 +55,7 @@ class ConfigList : public QTreeWidget { protected:void keyPressEvent (QKeyEvent *e); -void mousePressEvent (QMouseEvent *e);void mouseReleaseEvent (QMouseEvent *e); -void mouseMoveEvent (QMouseEvent *e);void mouseDoubleClickEvent (QMouseEvent *e);void focusInEvent (QFocusEvent *e);void contextMenuEvent (QContextMenuEvent *e);
Signature · 1 line
2.43.0
PATCH 2/13 kconfig: qconf: remove redundant type check for choice members
Since commit fde192511bdb ("kconfig: remove tristate choice support"), choice members are always boolean. The type check is redundant.
---
scripts/kconfig/qconf.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/kconfig/qconf.cc +1 -1
@@ -159,7 +159,7 @@ void ConfigItem::updateMenu(void) ch = 'M'; break; default: - if (sym_is_choice_value(sym) && type == S_BOOLEAN) + if (sym_is_choice_value(sym)) setIcon(promptColIdx, choiceNoIcon); else setIcon(promptColIdx, symbolNoIcon);
Signature · 1 line
2.43.0
PATCH 3/13 kconfig: qconf: remove unnecessary setRootIsDecorated() call
In reply to Masahiro YamadaThe default value of the rootIsDecorated property is true.
---
scripts/kconfig/qconf.cc | 1 - 1 file changed, 1 deletion(-)
scripts/kconfig/qconf.cc +0 -1
@@ -307,7 +307,6 @@ ConfigList::ConfigList(QWidget *parent, const char *name) { setObjectName(name); setSortingEnabled(false); - setRootIsDecorated(true); setVerticalScrollMode(ScrollPerPixel); setHorizontalScrollMode(ScrollPerPixel);
Signature · 1 line
2.43.0
PATCH 4/13 kconfig: qconf: remove unnecessary lastWindowClosed() signal connection
In reply to Masahiro YamadaThe default value of the quitOnLastWindowClosed property is true.
Hence, the application implicitly quits when the last window is closed.
---
scripts/kconfig/qconf.cc | 1 - 1 file changed, 1 deletion(-)
scripts/kconfig/qconf.cc +0 -1
@@ -1863,7 +1863,6 @@ int main(int ac, char** av) v = new ConfigMainWindow(); //zconfdump(stdout); - configApp->connect(configApp, SIGNAL(lastWindowClosed()), SLOT(quit())); configApp->connect(configApp, SIGNAL(aboutToQuit()), v, SLOT(saveSettings())); v->show();
Signature · 1 line
2.43.0
PATCH 5/13 kconfig: qconf: convert the last old connection syntax to Qt5 style
In reply to Masahiro YamadaCommit a2574c12df0d ("kconfig: qconf: convert to Qt5 new signal/slot connection syntax") converted most of the old string-based connections, but one more instance still remains. Convert it to the new style.
---
scripts/kconfig/qconf.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
scripts/kconfig/qconf.cc +3 -1
@@ -1475,6 +1475,9 @@ ConfigMainWindow::ConfigMainWindow(void) connect(helpText, &ConfigInfoView::menuSelected, this, &ConfigMainWindow::setMenuLink); + connect(configApp, &QApplication::aboutToQuit, + this, &ConfigMainWindow::saveSettings); + conf_read(NULL); QString listMode = configSettings->value("/listMode", "symbol").toString();
@@ -1863,7 +1866,6 @@ int main(int ac, char** av) v = new ConfigMainWindow(); //zconfdump(stdout); - configApp->connect(configApp, SIGNAL(aboutToQuit()), v, SLOT(saveSettings())); v->show(); configApp->exec();
Signature · 1 line
2.43.0
PATCH 6/13 kconfig: qconf: do not show goParent button in split view
In reply to Masahiro YamadaWhen a menu is selected in the split view, the right pane displays the goParent button, but it is never functional.
This is unnecessary, as you can select a menu from the menu tree in the left pane.
---
scripts/kconfig/qconf.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
scripts/kconfig/qconf.cc +1 -2
@@ -436,8 +436,7 @@ void ConfigList::updateList() return; } - if (rootEntry != &rootmenu && (mode == singleMode || - (mode == symbolMode && rootEntry->parent != &rootmenu))) { + if (rootEntry != &rootmenu && mode == singleMode) { item = (ConfigItem *)topLevelItem(0); if (!item) item = new ConfigItem(this, 0, true);
Signature · 1 line
2.43.0
PATCH 7/13 kconfig: qconf: remove ConfigItem::visible member
In reply to Masahiro YamadaThe " (NEW)" string should be displayed regardless of the visibility of the associated menu.
The ConfigItem::visible member is not used for any other purpose.
---
scripts/kconfig/qconf.cc | 28 +++++++++++----------------- scripts/kconfig/qconf.h | 15 +++++++-------- 2 files changed, 18 insertions(+), 25 deletions(-)
scripts/kconfig/qconf.cc +11 -17
@@ -175,17 +175,16 @@ void ConfigItem::updateMenu(void) setText(dataColIdx, sym_get_string_value(sym)); break; } - if (!sym_has_value(sym) && visible) + if (!sym_has_value(sym)) prompt += " (NEW)"; set_prompt: setText(promptColIdx, prompt); } -void ConfigItem::testUpdateMenu(bool v) +void ConfigItem::testUpdateMenu(void) { ConfigItem* i; - visible = v; if (!menu) return;
@@ -429,7 +428,7 @@ void ConfigList::updateList() item = (ConfigItem*)(*it); if (!item->menu) continue; - item->testUpdateMenu(menu_is_visible(item->menu)); + item->testUpdateMenu(); ++it; }
@@ -439,16 +438,16 @@ void ConfigList::updateList() if (rootEntry != &rootmenu && mode == singleMode) { item = (ConfigItem *)topLevelItem(0); if (!item) - item = new ConfigItem(this, 0, true); + item = new ConfigItem(this, 0); last = item; } if ((mode == singleMode || (mode == symbolMode && !(rootEntry->flags & MENU_ROOT))) && rootEntry->sym && rootEntry->prompt) { item = last ? last->nextSibling() : nullptr; if (!item) - item = new ConfigItem(this, last, rootEntry, true); + item = new ConfigItem(this, last, rootEntry); else - item->testUpdateMenu(true); + item->testUpdateMenu(); updateMenuList(item, rootEntry); update();
@@ -597,7 +596,6 @@ void ConfigList::updateMenuList(ConfigItem *parent, struct menu* menu) struct menu* child; ConfigItem* item; ConfigItem* last; - bool visible; enum prop_type type; if (!menu) {
@@ -629,14 +627,13 @@ void ConfigList::updateMenuList(ConfigItem *parent, struct menu* menu) break; } - visible = menu_is_visible(child); if (!menuSkip(child)) { if (!child->sym && !child->list && !child->prompt) continue; if (!item || item->menu != child) - item = new ConfigItem(parent, last, child, visible); + item = new ConfigItem(parent, last, child); else - item->testUpdateMenu(visible); + item->testUpdateMenu(); if (mode == fullMode || mode == menuMode || type != P_MENU) updateMenuList(item, child);
@@ -662,7 +659,6 @@ void ConfigList::updateMenuList(struct menu *menu) struct menu* child; ConfigItem* item; ConfigItem* last; - bool visible; enum prop_type type; if (!menu) {
@@ -694,14 +690,13 @@ void ConfigList::updateMenuList(struct menu *menu) break; } - visible = menu_is_visible(child); if (!menuSkip(child)) { if (!child->sym && !child->list && !child->prompt) continue; if (!item || item->menu != child) - item = new ConfigItem(this, last, child, visible); + item = new ConfigItem(this, last, child); else - item->testUpdateMenu(visible); + item->testUpdateMenu(); if (mode == fullMode || mode == menuMode || type != P_MENU) updateMenuList(item, child);
@@ -1274,8 +1269,7 @@ void ConfigSearchWindow::search(void) return; for (p = result; *p; p++) { for_all_prompts((*p), prop) - lastItem = new ConfigItem(list, lastItem, prop->menu, - menu_is_visible(prop->menu)); + lastItem = new ConfigItem(list, lastItem, prop->menu); } }
scripts/kconfig/qconf.h +7 -8
@@ -114,25 +114,25 @@ public slots: class ConfigItem : public QTreeWidgetItem { typedef class QTreeWidgetItem Parent; public: - ConfigItem(ConfigList *parent, ConfigItem *after, struct menu *m, bool v) - : Parent(parent, after), nextItem(0), menu(m), visible(v), goParent(false) + ConfigItem(ConfigList *parent, ConfigItem *after, struct menu *m) + : Parent(parent, after), nextItem(0), menu(m), goParent(false) {init (); } - ConfigItem(ConfigItem *parent, ConfigItem *after, struct menu *m, bool v) - : Parent(parent, after), nextItem(0), menu(m), visible(v), goParent(false) + ConfigItem(ConfigItem *parent, ConfigItem *after, struct menu *m) + : Parent(parent, after), nextItem(0), menu(m), goParent(false) {init (); } - ConfigItem(ConfigList *parent, ConfigItem *after, bool v) - : Parent(parent, after), nextItem(0), menu(0), visible(v), goParent(true) + ConfigItem(ConfigList *parent, ConfigItem *after) + : Parent(parent, after), nextItem(0), menu(0), goParent(true) {init (); } ~ConfigItem (void);void init (void );void updateMenu (void ); -void testUpdateMenu (bool v); +void testUpdateMenu (void );ConfigList *listView () const { return (ConfigList*)Parent::treeWidget();
@@ -159,7 +159,6 @@ class ConfigItem : public QTreeWidgetItem {ConfigItem * nextItem;struct menu *menu; -bool visible;bool goParent;static QIcon symbolYesIcon, symbolModIcon, symbolNoIcon;
Signature · 1 line
2.43.0
PATCH 8/13 kconfig: qconf: avoid unnecessary parentSelected() when ESC is pressed
In reply to Masahiro YamadaWhen the ESC key is pressed, the parentSelected() signal is currently emitted for singleMode, menuMode, and symbolMode.
However, parentSelected() signal is functional only for singleMode.
In menuMode, the signal is connected to the goBack() slot, but nothing occurs because configList->rootEntry is always &rootmenu.
In symbolMode (in the right pane), the parentSelected() signal is not connected to any slot.
This commit prevents the unnecessary emission of the parentSelected() signal.
---
scripts/kconfig/qconf.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/kconfig/qconf.cc +1 -1
@@ -724,7 +724,7 @@ void ConfigList::keyPressEvent(QKeyEvent* ev) struct menu *menu; enum prop_type type; - if (ev->key() == Qt::Key_Escape && mode != fullMode && mode != listMode) { + if (ev->key() == Qt::Key_Escape && mode == singleMode) { emit parentSelected(); ev->accept(); return;
Signature · 1 line
2.43.0
PATCH 9/13 kconfig: qconf: remove redundant check in goBack()
In reply to Masahiro YamadaThe same check is performed in the configList->setParentMenu() call.
---
scripts/kconfig/qconf.cc | 3 --- 1 file changed, 3 deletions(-)
scripts/kconfig/qconf.cc +0 -3
@@ -1616,9 +1616,6 @@ void ConfigMainWindow::listFocusChanged(void) void ConfigMainWindow::goBack(void) { - if (configList->rootEntry == &rootmenu) - return; - configList->setParentMenu(); }
Signature · 1 line
2.43.0
PATCH 10/13 kconfig: qconf: remove non-functional href="m..." tag
In reply to Masahiro YamadaThe only functional tag is href="s<symbol_name>".
Commit c4f7398bee9c ("kconfig: qconf: make debug links work again") changed prop->name to sym->name for this reference, but it missed to change the tag "m" to "s".
This tag is not functional at all.
---
scripts/kconfig/qconf.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/kconfig/qconf.cc +2 -2
@@ -1065,9 +1065,9 @@ QString ConfigInfoView::debug_info(struct symbol *sym) switch (prop->type) { case P_PROMPT: case P_MENU: - stream << "prompt: <a href=\"m" << sym->name << "\">"; + stream << "prompt: "; stream << print_filter(prop->text); - stream << "</a><br>"; + stream << "<br>"; break; case P_DEFAULT: case P_SELECT:
Signature · 1 line
2.43.0
PATCH 11/13 kconfig: add sym_get_prompt_menu() helper function
In reply to Masahiro YamadaSplit out the code that retrieves the menu entry with a prompt, so it can be reused in other functions.
---
scripts/kconfig/lkc_proto.h | 1 + scripts/kconfig/symbol.c | 26 +++++++++++++++++++------- 2 files changed, 20 insertions(+), 7 deletions(-)
scripts/kconfig/lkc_proto.h +1 -0
@@ -34,6 +34,7 @@ bool sym_string_valid(struct symbol *sym, const char *newval);bool sym_string_within_range (struct symbol *sym,const char *str);bool sym_set_string_value (struct symbol *sym,const char *newval);bool sym_is_changeable (const struct symbol *sym); +struct menu *sym_get_prompt_menu (const struct symbol *sym);struct menu *sym_get_choice_menu (const struct symbol *sym);const char *sym_get_string_value (struct symbol *sym);
scripts/kconfig/symbol.c +19 -7
@@ -70,6 +70,24 @@ const char *sym_type_name(enum symbol_type type)return "???" ; } +/** +* sym_get_prompt_menu - get the menu entry with a prompt +* +* @sym: a symbol pointer +* +* Return: the menu entry with a prompt. +*/ +struct menu *sym_get_prompt_menu (const struct symbol *sym) +{ +struct menu *m; + +list_for_each_entry (m, &sym->menus, link) +if (m->prompt) +return m; + +return NULL ; +} +/** * sym_get_choice_menu - get the parent choice menu if present *
@@ -80,18 +98,12 @@ const char *sym_type_name(enum symbol_type type)struct menu *sym_get_choice_menu (const struct symbol *sym) {struct menu *menu =NULL ; -struct menu *m;/* * Choice members must have a prompt. Find a menu entry with a prompt, * and assume it resides inside a choice block. */ -list_for_each_entry (m, &sym->menus, link) -if (m->prompt) { - menu = m; -break ; - } - + menu =sym_get_prompt_menu (sym);if (!menu)return NULL ;
Signature · 1 line
2.43.0
PATCH 12/13 kconfig: qconf: refactor ConfigInfoView::clicked()
In reply to Masahiro YamadaMost of the code in ConfigInfoView::clicked() is unnecessary. There is no need to use the regular expression to search for a symbol. Calling sym_find() is simpler and faster.
The hyperlink always begins with the "s" tag, and there is no other tag used. Remove it.
---
scripts/kconfig/qconf.cc | 43 ++++++---------------------------------- 1 file changed, 6 insertions(+), 37 deletions(-)
scripts/kconfig/qconf.cc +6 -37
@@ -1001,7 +1001,7 @@ void ConfigInfoView::menuInfo(void) if (sym->name) { stream << " ("; if (showDebug()) - stream << "<a href=\"s" << sym->name << "\">"; + stream << "<a href=\"" << sym->name << "\">"; stream << print_filter(sym->name); if (showDebug()) stream << "</a>";
@@ -1010,7 +1010,7 @@ void ConfigInfoView::menuInfo(void) } else if (sym->name) { stream << "<big><b>"; if (showDebug()) - stream << "<a href=\"s" << sym->name << "\">"; + stream << "<a href=\"" << sym->name << "\">"; stream << print_filter(sym->name); if (showDebug()) stream << "</a>";
@@ -1124,7 +1124,7 @@ void ConfigInfoView::expr_print_help(void *data, struct symbol *sym, const char QTextStream *stream = reinterpret_cast<QTextStream *>(data); if (sym && sym->name && !(sym->flags & SYMBOL_CONST)) { - *stream << "<a href=\"s" << sym->name << "\">"; + *stream << "<a href=\"" << sym->name << "\">"; *stream << print_filter(str); *stream << "</a>"; } else {
@@ -1134,39 +1134,11 @@ void ConfigInfoView::expr_print_help(void *data, struct symbol *sym, const char void ConfigInfoView::clicked(const QUrl &url) { - QByteArray str = url.toEncoded(); - const std::size_t count = str.size(); - char *data = new char[count + 2]; // '$' + '\0' - struct symbol **result; - struct menu *m = NULL; + struct menu *m; - if (count < 1) { - delete[] data; - return; - } - - memcpy(data, str.constData(), count); - data[count] = '\0'; - - /* Seek for exact match */ - data[0] = '^'; - strcat(data, "$"); - result = sym_re_search(data); - if (!result) { - delete[] data; - return; - } - - sym = *result; - - /* Seek for the menu which holds the symbol */ - for (struct property *prop = sym->prop; prop; prop = prop->next) { - if (prop->type != P_PROMPT && prop->type != P_MENU) - continue; - m = prop->menu; - break; - } + sym = sym_find(url.toEncoded().constData()); + m = sym_get_prompt_menu(sym); if (!m) { /* Symbol is not visible as a menu */ symbolInfo();
@@ -1174,9 +1146,6 @@ void ConfigInfoView::clicked(const QUrl &url) } else { emit menuSelected(m); } - - free(result); - delete[] data; } void ConfigInfoView::contextMenuEvent(QContextMenuEvent *event)
Signature · 1 line
2.43.0
PATCH 13/13 kconfig: qconf: remove unnecessary mode check in ConfigItem::updateMenu()
In reply to Masahiro YamadaThe P_MENU entries ("menu" and "menuconfig") are never displayed in symbolMode.
The condition, list->mode == symbolMode, is never met here.
---
scripts/kconfig/qconf.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/kconfig/qconf.cc +1 -1
@@ -110,7 +110,7 @@ void ConfigItem::updateMenu(void) if (prop) switch (prop->type) { case P_MENU: - if (list->mode == singleMode || list->mode == symbolMode) { + if (list->mode == singleMode) { /* a menuconfig entry is displayed differently * depending whether it's at the view root or a child. */
Signature · 1 line
2.43.0